# -*- coding: utf-8 -*-
# !/usr/bin/env python3

"""
@Author   : Leonis.Li
@Email    : leonis.li.ext@zeiss.com
@Cellphone:
@Version  : 1.0
@License  : Apache Licence
@Script   : ocr_service.py
@CreateAt : 2023/10/11 21:35
@UpdateAt : 2023/10/11 21:35
"""


from flask import Flask, jsonify, request

from src.api.v2 import ocr_v2_bp
from src.config.base import DevEnvConfig


def create_app():
    """Create flask app."""

    # Create application
    flask_app = Flask(__name__)

    # flask app configs
    flask_app.config.from_object(DevEnvConfig)

    # Set logger
    DevEnvConfig.set_logger(flask_app=flask_app)

    return flask_app

# FLASK APP
# app = create_app()
app = Flask(__name__)

# Register api-v2-bp
app.register_blueprint(ocr_v2_bp)


@app.route("/", methods=["GET"])
def index():

    data = {
        "status": 200,
        "message": "OCR API(V2.0) text recognition service is running ...",
    }

    return jsonify(data)



if __name__ == "__main__":

    # Start flask service
    app.run(host="0.0.0.0", port=5055, debug=False)
